import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home/Home.vue';
import Category from '../views/Category/Category.vue';
import Shopcart from '../views/Shopcart/Shopcart.vue';
import User from '../views/User/User.vue';
import Shoping from "../views/Shoping/Shoping.vue";
import ZX from "../views/Home/category/zx.vue"
import SP from "../views/Home/category/sp.vue";
const routes = [
  {
    path: "/",
    redirect: "home/zx",
  },
  {
    path: "/home",
    // name: "home",
    component: Home,
    meta: {
      title: "海外别样购-人气",
    },
    children: [
      {
        path: "zx",
        name: "zx",
        component: ZX,
      },
      {
        path: "sp",
        name: "sp",
        component: SP,
      },
    ],
  },
  {
    path: "/category",
    name: "category",
    component: Category,
    meta: {
      title: "海外别样购-分类",
    },
  },
  {
    path: "/shopcart",
    name: "shopcart",
    component: Shopcart,
    meta: {
      title: "海外别样购-购物袋",
    },
  },
  {
    path: "/user",
    name: "user",
    component: User,
    meta: {
      title: "海外别样购-我的",
    },
  },
  {
    path: "/shoping",
    name: "shoping",
    component: Shoping,
    meta: {
      title: "海外别样购-商家",
    },
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})
router.beforeEach((to, from, next) => {
    next();
  document.title = to.meta.title;
});
export default router
